<!--侧边漂浮边栏-->
<div class="side_bar hidee">
    <div class="side_line"></div>
    <ul>
        <li class="activeSec"><div class="side_btn"></div><a class="topLink" href="#news">赛事动态</a> </li>
        <li class="inactiveSec"><div class="side_btn"></div><a class="topLink" href="#mission">大赛宗旨</a> </li>
        <li class="inactiveSec"><div class="side_btn"></div><a class="topLink" href="#instruction">参赛指南</a> </li>
        <li class="inactiveSec"><div class="side_btn"></div><a class="topLink" href="#schedule">大赛日程</a> </li>
        <li class="inactiveSec"><div class="side_btn"></div><a class="topLink" href="#judge">专家评审</a> </li>
    </ul>
</div>

<script src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">

    $(document).ready(function(){

        if ($(window).width() < 1430)
            $('.side_bar').fadeOut();

        $(".side_btn").css("margin-left", "-8px");

        $("a.topLink").click(function() {
            $("html, body").animate({
                scrollTop: $($(this).attr("href")).offset().top - 120 + "px"
            }, {
                duration: 500,
                easing: "swing"
            });
        })

        $(window).scroll(function(){
            var top = $(window).scrollTop();
            if (top > 700 && $(window).width() >= 1430) {
                $('.side_bar').fadeIn();
            } else {
                $('.side_bar').fadeOut();
            };

            var contentId = "";
            var sections=$("section");
            sections.each(function(){
                var m=$(this);
                var mTop=m.offset().top;
                if(top>mTop-140){
                    contentId="#"+m.attr("id");
                    console.log(contentId);
                }else{
                    return false;
                }
            });
            if (contentId == "")
                 return;

            $(".activeSec:first").removeClass('activeSec').addClass('inactiveSec');
            $('[href="' + contentId+'"]').closest(".inactiveSec").removeClass('inactiveSec').addClass('activeSec');
        })
    })

</script>